package com.wzy.designpattern.structural.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * 描述
 * 创建人    Wzy
 * 创建时间: 2020-05-16  2:42
 */
public class EmployeeFactory {
    private static final Map<String, Employee> MAP = new HashMap<>();

    public static Employee getManger(String department) {
        Manager manager = (Manager) MAP.get(department);
        if (manager == null) {
            manager = new Manager(department);
            System.out.println("渐渐部门经理:" + department);
            String reportContent = department + "开始做报告......";
            manager.setReportContent(reportContent);
            System.out.println("创建报告:" + reportContent);
            MAP.put(department, manager);
            System.out.println("创建部门经理:" + department);
        }
        return manager;
    }
}
